# 1.7 Flowing LED Today, we will use LED, Raspberry Pi and scratch to make a Water Lamp. The LED will light up in order with the direction of the arrows on the stage. ![](./img/1.7/1.7_header.png) ## Required Components ![](./img/1.7/1.7_list.png) ## Build the Circuit ![](./img/1.7/1.7_fritzing.png) ## Load the Code and See What Happens By clicking on **Arrow1**, the LEDs are lit in sequence from the left to the right (one at a time) and then off. Click **Arrow2** and the LEDs light up in the opposite order. ## Tips on Sprites Delete the default sprite and choose the **Arrow1** sprite. ![](./img/1.7/1.7_sprite.png) Here we will need 2 **Arrow1** sprites, which can be done with the duplicate button. ![](./img/1.7/1.7_sprite1.png) Click on the **Arrow 2** sprite and change the direction of the arrow by selecting arrow1-b. ![](./img/1.7/1.7_sprite2.png) Now let’s make a variable. ![](./img/1.7/1.7_code.png) Name it as **num**. ![](./img/1.7/1.7_code1.png) Follow the same method to create a list called **led**. ![](./img/1.7/1.7_code2.png) After adding, you should see the **num** variable and the **led** list on the stage area. Click **+** to add 10 list items and enter the pin numbers in order (17,18,27,22,23,24,25,2,3,8). ![](./img/1.7/1.7_code3.png) ![](./img/1.7/1.7_code4.png) ![](./img/1.7/1.7_code5.png) ## Tips on Codes ![](./img/1.7/1.7_code6.png) This is an event block that is triggered when the current sprite is clicked. ![](./img/1.7/1.7_code7.png) The initial value of the **num** variable determines which LED is lit first. ![](./img/1.7/1.7_code8.png) Set the pin corresponding to **num** in the led list to low to light the LED, and then set the pin corresponding to **num-1** to high to turn off the previous LED.